<?php

namespace Trawind\Extension\Models\Custom;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;
use Trawind\Basics\Enums\BusinessType;
use Trawind\Extension\Traits\CustomData;

/**
 * Class Form.
 *
 * @package namespace Trawind\Extension\Models\Custom\Form;
 */
class Form extends Model implements Transformable
{

    use TransformableTrait, CustomData;

    const ORIGIN_TYPE_ENUM = [
        'system_form' => 1,
        'custom_form' => 2
    ];

    protected $table = 'custom_forms';

    protected $connection = 'mysql';

    protected $guarded = ['created_at', 'updated_at'];

    protected $dateFormat = 'U';

    public $incrementing = false;

    public $businessType = BusinessType::EXTENSION_CUSTOM_FORM;

    public function fields()
    {
        return $this->hasMany(FormField::class, 'form_id', 'id');
    }

}
